package com.xxrl.shop.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.MongoId;

import javax.persistence.EntityListeners;
import java.io.Serializable;


/**
 * @author mis
 */
@ApiModel(description = "Address information of user.")
@Data
@Document(collection = "user_cart")
@EntityListeners(AuditingEntityListener.class)
public class Cart implements Serializable {
    @ApiModelProperty(notes = "Unique identifier of the Cart.", example = "000000000000000000000000",
            required = true)
    @MongoId
    private String id;

    @ApiModelProperty(notes = "Relative user id", example = "1")
    @Field
    private Long userId;

    @Field
    private String productName;

    @ApiModelProperty(notes = "Relative product id", example = "1")
    @Field
    private Long productId;

    @ApiModelProperty(notes = "Url address of product picture.", example = "https://exapmle.com/favicon.ico")
    @Field
    private String productImg;

    @Field
    private Boolean checked;

    @ApiModelProperty(notes = "Storage product count.", example = "2")
    @Field
    private Integer productNum;

    @ApiModelProperty(notes = "Price of product.", example = "30")
    @Field
    private Integer productPrice;

    @CreatedDate
    @Field
    private Long createTime;

    @LastModifiedDate
    @Field
    private Long lastModifiedTime;
}
